#include "unp.h"
#include "file_fp.h"

#define FILEOPEN(fd, filename, mode) fd=fopen(filename,mode);\
    if(NULL == fp) {\
        err_sys("errno: %d, error info: %s\n", errno, strerror(errno));\
        return -1;\
    }\

#define FILECLOSE(ret, fp) \
    ret = fclose(fp);\
    if(0 != ret) {\
        err_sys("errno: %d, error info: %s\n", errno, strerror(errno));\
        return -1;\
    }\

int fileOpenTest(void) {
    FILE* fp = NULL;
    FILEOPEN(fp, "./test.txt", "r+");
    char ptr[256] = "hello ChuangYi";
    Write_fp(fp, ptr);
    int ret = 0;
    FILECLOSE(ret, fp);

    return 0;
}
